package com.crl.module.loaders.workers
{
	import flash.display.Loader;
	import flash.events.Event;
	import flash.events.HTTPStatusEvent;
	import flash.events.IOErrorEvent;
	import flash.events.ProgressEvent;
	import flash.events.SecurityErrorEvent;
	import flash.net.URLRequest;

	public class BitmapWorker extends Worker
	{
		public function BitmapWorker()
		{
			super();
		}
		
		override public function load(request:URLRequest,autoStart:Boolean=false):void{
			super.load(request);
			loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.OPEN, onOpen);
			loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
			loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus);
			loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOLoadError);
			loader.contentLoaderInfo.addEventListener(IOErrorEvent.DISK_ERROR, onIOLoadError);
			loader.contentLoaderInfo.addEventListener(IOErrorEvent.NETWORK_ERROR, onIOLoadError);
			loader.contentLoaderInfo.addEventListener(IOErrorEvent.VERIFY_ERROR, onIOLoadError);
			loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
		}
		
		override protected function onComplete(event:Event) : void{
			_data=event.target;
			super.onComplete(event);
		} 
	}
}